<%@ page contentType="text/html; charset=UTF-8" buffer="16kb"%>
<%@ page import="com.sinodata.bsm.center.web.action.performance.ErrorLogBean"%>

<%@ include file="../include/taglib.jsp"%>
<%
    response.setHeader("Cache-Control", "no-store");
    response.setHeader("Pragrma", "no-cache");
    response.setDateHeader("Expires", 0);
    Long resid = Long.parseLong(request.getParameter("id"));
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>linux综合性能页面</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="pragma" content="no-cache" />
<meta http-equiv="cache-control" content="no-cache" />
<meta http-equiv="expires" content="0" />
<meta name="Keywords" content=" " />
<meta name="Description" content=" " />
 <%@ include file="../include/common.jsp"%>

<script type="text/javascript"
	src="${pageContext.request.contextPath}/js/common/jquery-ui-1.8.13.slider.min.js"></script>

<script type="text/javascript"
	src="${pageContext.request.contextPath}/js/common/jPaginator-min.js"></script>
	

<link rel="stylesheet" type="text/css"
	href="${pageContext.request.contextPath}/style/default/bsm/sub_menu.css" />
	
<link rel="stylesheet" type="text/css"
	href="${pageContext.request.contextPath}/style/default/bsm/perf/listPage.css" />
	
<link rel="stylesheet" type="text/css"
	href="${pageContext.request.contextPath}/style/default/bsm/perf/jPaginator.css" />
	
<script type="text/javascript"
	src="${pageContext.request.contextPath}/js/common/jquery.highlight-3.js"></script>
	
<script type="text/javascript"
	src="${pageContext.request.contextPath}/js/common/jquery.textEllipsis.js"></script>
	


<script type="text/javascript">
$(document).ready(function() {
	
		$(window).scroll(function () {
			if ($(this).scrollTop() > 100) {
				$('#back-top').fadeIn();
			} else {
				$('#back-top').fadeOut();
			}
		});
	
		// scroll body to 0px on click
		$('#back-top a').click(function () {
			$('body,html').animate({
				scrollTop: 0
			}, 800);
			return false;
		});
		
	    var varid =100;
		function changePage(page){
			$.ajax({
				url : 'real-time!getErrorLogList.action', // 
				type : 'POST',
				dataType : "json",
				data : {
					resId :<%=resid %>,
					page:page
				},
				success : function(data) {
					    $('#rso li').remove();
						$.each(data.log,function(i,value){
							$('#rso').append('<li><div id='+varid+' class ="content-li"><div class="divTitle"><span>文件名称:</span><span>'+value.fileName+'</span><span>时间:</span><span>'+value.time+'</span><span>错误标识:</span><span>'+value.errorFlag+'</span></div><div class="errorContent">'+value.errorContent+'</div></div></li>');	
							$('#'+varid+' .errorContent').highlight(value.errorFlag);
							varid+=1;
						});
				}
			});
		}
		
		 $('#timeSec  ul  li').on('mouseover', function(){
             $(this).addClass('time-hover').siblings().removeClass('time-hover');
         }).on('mouseout', function(){
	            $(this).removeClass('time-hover');
         });
		
		$('#timeSec  ul  li').click(function(){
			$(this).addClass('time-selected').siblings().removeClass('time-selected');
			$.ajax({
				url : 'real-time!getErrorLogList.action', // 
				type : 'POST',
				dataType : "json",
				data : {
					resId :<%=resid %>,
					time:$(this).children('span').attr('value'),
					page:'0'
				},
				success : function(data) {
					if(data.total == 0){
						$('#rso').append('<li><div class ="content-li"><div class="divTitle">无错误日志...</div></div></li>');
					}else{
						$('#rso li').remove();
						var pageCnt = data.pageCnt;
						$.each(data.log,function(i,value){
							$('#rso').append('<li><div id='+varid+' class ="content-li"><div class="divTitle"><span>文件名称:</span><span>'+value.fileName+'</span><span>时间:</span><span>'+value.time+'</span><span>错误标识:</span><span>'+value.errorFlag+'</span></div><div class="errorContent">'+value.errorContent+'</div></div></li>');	
							$('#'+varid+' .errorContent').highlight(value.errorFlag);
							varid+=1;
						});
						
						$('#pagination').jPaginator({
							nbPages:pageCnt,
							marginPx:6,
							length:8,
							overBtnLeft:'#over_backward', 
							overBtnRight:'#over_forward', 
							maxBtnLeft:'#max_backward', 
							maxBtnRight:'#max_forward', 
							onPageClicked: function(a,num) {
								changePage(num);
							}
						});
					}
				}
			});
	    });
		$('#timeSec  ul  li :first').click();
	});

</script>
</head>
<body>

	<!--  
    <div class="column" style="height:100px;">
			<div class="col-main" >
					<div class="col-net-main " style="width:99%;height:95px;" >
						<h2 class="title-h2 m-0">最近一次错误日志</h2>
							<ul class="col-l-ul">
								<li>
									时间:<span>2012.08.05 11:00:23</span>
									<span  width="30px;"></span>
								 	错误标识:<span>OutOfMemoryError</span>
								</li>
								<li>
									
								</li>
			               </ul>
				  </div>
		</div>
	</div>	
	-->
    <div class="col-main">
			<div class="col-l-extra h-log-400" id="timeSec">
			   <ul class="col-l-ul">
					<li><span class="col-l-ul-l" class="baseinfo" value="10">最近一天</span>
					</li>
					<li><span class="col-l-ul-l" class="baseinfo" value="11">最近三天</span>
					</li>
					<li><span class="col-l-ul-l" class="baseinfo" value="12">最近一周</span>
					</li>
					<li><span class="col-l-ul-l" class="baseinfo" value="13">最近一月</span>
					</li>
				    <li><span class="col-l-ul-l" class="baseinfo" value="14">最近三月</span>
					</li>
			  </ul>
			</div>
			
			<div class="col-log-r-main " style="text-align:left;">
			
				<div id="pagination" style="width:700px;margin:10px 20px 30px 130px;"> 
					<a class="jPaginatorMax" id="max_backward">First</a>
					<a class="jPaginatorOver" id="over_backward">前进</a> 
					<div class='paginator_p_wrap'> 
						<div class='paginator_p_bloc'> 
								
						</div>
					</div> 
					<a class="jPaginatorOver" id="over_forward">后退</a>
					<a class="jPaginatorMax" id="max_forward">Last</a>
		        </div>
		        
		        
				<div class="col-log-v-rate-extra " >
					<ol id="rso">
						
					</ol>
				</div>
				
				
				<div class="col-log-v-rate-extra log-r" >
					<p id="back-top">
						<a href="#top"><span></span>返回顶部</a>
					</p>
				</div>
	       </div>
		</div>
		
</body>